import {Loading} from 'element-ui';

let loadingInstance
let loadingOptions = {
  target: document.body,
  lock: true,
  fullscreen: true,
  text: '加载中...',
  spinner: 'el-icon-loading',
  background: 'rgba(0, 0, 0, 0.6)',
}

export function loadingStart(config) {
  loadingInstance = Loading.service(Object.assign({}, loadingOptions, config))
}

export function loadingEnd() {
  if (loadingInstance) {
    loadingInstance.close()
  }
}

